package com.project.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.project.bean.DrugBean;
import com.project.dao.IDrugDao;
import com.project.service.IDrugService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author RJ
 * @date 2022/9/15 15:36
 */
@Service
@Transactional
public class DrugServiceImpl extends ServiceImpl<IDrugDao, DrugBean> implements IDrugService {

    @Override
    public void addDrug(DrugBean drugBean) {
        this.save(drugBean);
    }

    @Override
    public IPage<DrugBean> cutDrugByItem(Integer pageNo, Integer pageSize,
                                         String drugName, String drugControlType, String drugType) {
        Page<DrugBean> page = new Page<>(pageNo, pageSize);
        IPage<DrugBean> iPage = this.baseMapper.cutDrugByItem(page, drugName, drugControlType, drugType);
        return iPage;
    }
}
